package io.zcoder.innoway.fragments;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.zcoder.innoway.R;
import io.zcoder.innoway.activities.BaseActivity;
import io.zcoder.innoway.adapters.ViewPagerTrendAdapter;
import me.relex.circleindicator.CircleIndicator;

public class TrendFragment extends BaseFragment implements ViewPager.OnPageChangeListener {

    @BindView(R.id.viewPager)
    ViewPager mViewPager;
    @BindView(R.id.indicator)
    CircleIndicator mIndicator;
    @BindView(R.id.common_history)
    ImageView mCommonHistory;
    @BindView(R.id.common_trend_list)
    ImageView mCommonTrendList;


    @OnClick(R.id.common_trend_list)
    void openTrendList() {

    }

    @OnClick(R.id.common_history)
    void openHistory() {

    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.layout_trend_fragment, container, false);
        ButterKnife.bind(this, view);
        setTitle(getString(R.string.trend_weight));
        mCommonTrendList.setVisibility(View.VISIBLE);
        mCommonHistory.setVisibility(View.VISIBLE);

//        ViewPagerTrendAdapter adapter = new ViewPagerTrendAdapter(null, ((BaseActivity) getActivity()).getSupportFragmentManager());
//        mViewPager.setAdapter(adapter);
//        mIndicator.setViewPager(mViewPager);
//        mViewPager.setOnPageChangeListener(this);

        return view;
    }

    @Override
    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

    }

    @Override
    public void onPageSelected(int position) {
        switch (position) {
            case 0:
                setTitle(getString(R.string.trend_weight));
                break;
            case 1:
                setTitle(getString(R.string.trend_bmi));
                break;
            case 2:
                setTitle(getString(R.string.trend_body_fat));
                break;
            case 3:
                setTitle(getString(R.string.trend_muscle));
                break;
            case 4:
                setTitle(getString(R.string.trend_protein));
                break;
            case 5:
                setTitle(getString(R.string.trend_water));
                break;
            case 6:
                setTitle(getString(R.string.trend_visceral_fat));
                break;
            case 7:
                setTitle(getString(R.string.trend_bone_mass));
                break;
            case 8:
                setTitle(getString(R.string.trend_bmr));
                break;
            case 9:
                setTitle(getString(R.string.trend_fitness_age));
                break;
        }
    }

    @Override
    public void onPageScrollStateChanged(int state) {

    }
}
